
# wxWindows definitions for OSX 
TOOLKITDIR=/Users/kdurbin/src/libs/wxMac-2.4.2/src/mac/
WX_MAJOR_VERSION_NUMBER=2
WX_MINOR_VERSION_NUMBER=4
WX_RELEASE_NUMBER=2
INSTALL=/usr/bin/install -c 

# Location for installed components of OSX wxWindows
WXMACINCLUDES= -I/home/hgsc/lib/wx/include/mac-2.4 -I/home/hgsc/include/ -I/Developer/Headers/FlatCarbon
WXMACFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -no-cpp-precomp -fpascal-strings -D__WXMAC__ -MMD 
WXMACLIB = /home/hgsc/lib/libwx_mac-2.4.a -framework Carbon -framework System -lz -lpthread

# Location for installed components of X11 wxWindows 
WXINCLUDES= -I/home/hgsc/lib/wx/include/motif-2.4 -I/usr/dt/include -I$(CBT_INSTALL_ROOT)/include/ 
WXFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMOTIF__  -MMD  -D_REENTRANT 
# Solaris Motif
WXLIB = $(CBT_INSTALL_ROOT)/lib/libwx_motif-2.4.a -pthreads -lXm -lXpm -lXmu -lXt -lSM -lICE -lX11 -ljpeg -ltiff -lposix4 -lnsl -lsocket -lm 


#wxWindows objects
wxmaclocalobjs = $(libtargets:%=$(CBT_OBJ)/%.wxmac.o)
wxlocalobjs = $(libtargets:%=$(CBT_OBJ)/%.wx.o)

_wxlocallib: $(wxlocalobjs)
_wxmaclocallib: $(wxmaclocalobjs)

# Compile wxWindows MAC
$(CBT_OBJ)/%.wxmac.o: %.cc $(libdependencies)
	$(GCC) $(CCFLAGS) $(WXMACFLAGS) -O3 $(INCLUDES_CC) $(WXMACINCLUDES) -c -o $(CBT_OBJ)/$*.wx.o $*.cc 

# With the addition of wxWindows applications, compile conditions have been added 
# for those.  For now, there will be separate compile options for wxMac and wxX11
# but later these might be merged into a single wx compile.  The suffixes for these 
# are .wxmac and .wxx11 respectively. 
# 
# Compile wxWindows local object files. 
$(CBT_OBJ)/%.wxmac.o: %.cc $(libdependencies)
	$(GCC) $(CCFLAGS) $(WXMACFLAGS) -O3 $(INCLUDES_CC) $(WXMACINCLUDES) -c -o $(CBT_OBJ)/$*.wxmac.o $*.cc 

%.wxmac: %.cc _cbtlib _wxmaclocallib
	$(GCC) $(CCFLAGS) $(WXMACFLAGS) -O3 $(INCLUDES_CC) $(WXMACINCLUDES) -c -o $(CBT_OBJ)/$*.o $*.cc 
	c++ $(LINKFLAGS) -o $* $(LIB_PATHS) $(CBT_OBJ)/$*.o $(wxmaclocalobjs) $(CBT_LIB)/libcbt.a  -lstdc++ -lm -lgzstream -lz $(WXMACLIB)
	/Developer/Tools/Rez -t APPL Carbon.r /home/hgsc/lib/libwx_mac-2.4.0.r -o $* 


# Compile wxWindows local object files. 
$(CBT_OBJ)/%.wx.o: %.cc $(libdependencies)
	$(GCC) $(WXCCFLAGS) $(WXFLAGS) -O3 $(INCLUDES_CC) $(WXINCLUDES) -c -o $(CBT_OBJ)/$*.wx.o $*.cc 

# Compile wxWindows application. 
%.wx: %.cc _cbtlib _wxlocallib
	$(GCC) $(WXCCFLAGS) $(WXFLAGS) -O3 $(INCLUDES_CC) $(WXINCLUDES) -c -o $(CBT_OBJ)/$*.o $*.cc 
	c++ $(WXLINKFLAGS) -o $* $(LIB_PATHS) $(CBT_OBJ)/$*.o $(wxlocalobjs) $(CBT_LIB)/libcbt.a  -lstdc++ -lm -lgzstream -lz -lboost_regex $(WXLIB)


#==================================================================
# wxMac bundle
#==================================================================
#
# Targets to build a Mac OS X application bundle
# This part of the Makefile was copied and modified from makeprog.env in the wxWindows distribution. 
#
%.bundle: %.MacOS %.Info %.PkgInfo %.Resources %.icns
	echo $*.bundle

%.MacOS: $(CBT_DEVEL_LIB)/%.o _locallib 
	/usr/bin/install -c -d $*.app/Contents/MacOS
	c++ $(LINKFLAGS) -o $*.app/Contents/MacOS/$* $(LIB_PATHS) $(CBT_DEVEL_LIB)/$*.o $(localobjs) $(CBT_LIB)/libcbt.a  -lstdc++ -lm -lgzstream -lz -lboost_regex $(WXMACLIB)

%.Info: 
	@$(INSTALL) -d `dirname $@`
	sed -e "s/IDENTIFIER/`echo $* | sed 's,/,.,g'`/" \
	    -e "s/EXECUTABLE/$*/" \
	    -e "s/VERSION/$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER)/" $(TOOLKITDIR)/Info.plist.in > $*.app/Contents/Info.plist

%.PkgInfo:
	echo -n "APPL????" > $*.app/Contents/PkgInfo

%.Resources: $(CBT_INSTALL_ROOT)/lib/libwx_mac-2.4.0.rsrc
	/usr/bin/install -c -d $*.app/Contents/Resources
	cp $(CBT_INSTALL_ROOT)/lib/libwx_mac-2.4.0.rsrc $*.app/Contents/Resources/$*.rsrc

%.icns: 
	cp $(TOOLKITDIR)/wxmac.icns $*.app/Contents/Resources/wxmac.icns



